package com.outdoor.server.mapper;

import com.github.pagehelper.Page;
import com.outdoor.pojo.dto.TracePageQueryDTO;
import com.outdoor.pojo.entity.Trace;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TraceMapper {
    /**
     * 插入一条路线信息
     * @param trace 路线信息
     * @return
     */
    int insert(Trace trace);

    /**
     * 路线分页查询
     * @param tracePageQueryDTO
     * @return
     */
    Page<Trace> page(TracePageQueryDTO tracePageQueryDTO);

    /**
     * 根据区域id查询路线信息
     * @param id
     * @return
     */
    @Select("SELECT * FROM trace WHERE rid = #{id}")
    List<Trace> selectByRegionId(Long id);

    /**
     * 根据id查询路线信息
     * @param id
     * @return
     */
    @Select("SELECT * FROM trace WHERE id = #{id}")
    Trace selectById(Integer id);

    /**
     * 更新
     * @param trace
     */
    void update(Trace trace);
}